home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / GuiCtrlCreateGraphic.au3 < prev    next >
Text File  |  2007-09-08  |  3KB  |  91 lines

  1. #include <GUIConstants.au3>
  2.     
  3. $MAXGr=6
  4. Global $a[$MAXGr+1]    ; 0 and $MAXGr entries not used to allow GUICtrlDelete result
  5. Global $child, $del
  6.  
  7. CreateChild()
  8.  
  9. $i=1
  10. $inc=1
  11. Do
  12.     $msg = GUIGetMsg()
  13.  
  14.     if $msg= $del then
  15.         GuiCtrlDelete($a[$i])
  16.         $i = $i+$inc
  17.         if $i <0 OR $i>$MAXGr then exit
  18.         EndIf
  19.         if $msg>0 then MsgBox(0,"clicked", $msg & @LF & $a[5], 2)
  20. Until $msg=$GUI_EVENT_CLOSE
  21.  
  22. Func Del()
  23.     GuiDelete($child)
  24.     CreateChild()
  25. EndFunc
  26.  
  27. Func CreateChild()
  28. $child=GUICreate("My Draw")
  29. $del=GuiCtrlCreateButton("Delete", 50,165, 50)
  30.  
  31.  
  32. $a[1]=GuiCtrlCreateGraphic(20, 50, 100,100)
  33. GUICtrlSetBkColor(-1,0xffffff)
  34. GUICtrlSetColor(-1,0)
  35.  
  36. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000,0xff0000)
  37. GUICtrlSetGraphic(-1,$GUI_GR_PIE, 50,50, 40,30,270)
  38. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xffffff)
  39. GUICtrlSetGraphic(-1,$GUI_GR_PIE, 58,50, 40,-60,90)
  40.  
  41. GUICtrlSetGraphic(-1,$GUI_GR_ELLIPSE, 100,100, 50,80)
  42. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xc0c0ff)
  43. GUICtrlSetGraphic(-1,$GUI_GR_RECT, 350,200, 50,80)
  44. GuiCtrlCreateLabel("label", 65, 100, 30)
  45. GUICtrlSetColor(-1,0xff)
  46.  
  47.  
  48. $a[2]=GuiCtrlCreateGraphic(220, 50, 100,100)
  49. GUICtrlSetStyle(-1, $SS_NOTIFY)
  50. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0, 0xff)
  51. GUICtrlSetGraphic(-1,$GUI_GR_PIE, 50,50, 40,30,270)
  52. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x00ff00,0xffffff)
  53. GUICtrlSetGraphic(-1,$GUI_GR_PIE, 58,50, 40,-60,90)
  54.  
  55. $a[3]=GuiCtrlCreateGraphic(220, 150, 100,100,0)
  56. GUICtrlSetBkColor(-1,0xf08080)
  57. GUICtrlSetColor(-1,0xff)
  58. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff00)
  59. GUICtrlSetGraphic(-1,$GUI_GR_RECT, 50,50, 80,80)
  60.  
  61. $a[4]=GuiCtrlCreateGraphic(20, 200, 80,80)
  62. GUICtrlSetState(-1, $GUI_DISABLE)
  63. GUICtrlSetBkColor(-1,0xffffff)
  64. GUICtrlSetGraphic(-1,$GUI_GR_MOVE, 10,10)
  65. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff)
  66. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 30,40)
  67. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff00)
  68. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 70,70)
  69. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000)
  70. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 10,50)
  71. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xffff00)
  72. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 10,10)
  73.  
  74. $a[5]=GuiCtrlCreateGraphic(150, 10, 50,50,0)
  75. GUICtrlSetBkColor(-1,0xa0ffa0)
  76. GUICtrlSetGraphic(-1,$GUI_GR_MOVE, 20,20)        ; start point
  77. ; it is better to draw line and after point
  78. ; to avoid to switch color at each drawing
  79. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x0000ff)
  80. GUICtrlSetGraphic(-1,$GUI_GR_DOT, 30,30)
  81. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0)
  82. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 20,40)
  83. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0xff0000)
  84. GUICtrlSetGraphic(-1,$GUI_GR_DOT, 25,25)
  85. GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0)
  86. GUICtrlSetGraphic(-1,$GUI_GR_LINE, 40,40)
  87. GUICtrlSetGraphic(-1,$GUI_GR_DOT, 40,40)
  88.  
  89. GuiSetState()
  90. EndFunc
  91.